<?php

/**
 * More Helper
 */
class Zend_View_Helper_Moreviewurl extends Zend_View_Helper_Abstract {
    
    private $_arrCateInfo = array();
    
    /**
     * Get URL More New
     * @param <array> $arrCategory
     * @param <int> $intRecordLast
     * @return string
     * @author KIETTHM
     */
    public function Moreviewurl($arrCategory = array(),$intRecordLast,$code='news')
    {
        //Init URL
        switch ($code)
        {
            case 'news':
            {
                if(!isset($arrCategory['catecode'])){
                    $arrCategory['catecode'] = $this->_getArticleCode($arrCategory['category_id']);
                }
                $url = BASE_URL . '/xem-them/' . $arrCategory['catecode'] . '-' . $arrCategory['category_id'] . '-'.$intRecordLast.'-1.html';
                break;
            }
            case 'tag':
            {
                $url = BASE_URL . '/' . $arrCategory['tag_name_filter'] . '/tag-' . $arrCategory['tag_id'] . '-1.html';
                break;
            }
            case 'topic':
            {
                $url = BASE_URL . '/' . $arrCategory['topic_name_filter'] . '/topic-' . $arrCategory['topic_id'] . '-1.html';
                break;
            }
            default:
        }

        //Return Data
        return $url;
    }
    
    private function  _getArticleCode($intCategoryID){
        if(!isset($this->_arrCateInfo[$intCategoryID])){
            $this->_arrCateInfo[$intCategoryID] = Category::getInstance()->getCategoryByID($intCategoryID);
        }
        return $this->_arrCateInfo[$intCategoryID]['catecode'];
    }

}